<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>4_2_2-1-按键修饰符Event</title>
</head>

<body>


  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  <div id="Application">
    <h3>方法一：</h3>
    <input @keyup="keyup" />
    <h3>方法二：</h3>
    <input @keyup.enter="keyup"></input>
  </div>
  <script>
    const App = {
      data() {
        //返回对象
        return {};
      },

      methods: {
        keyup(event) {
          console.log("键盘按键抬起");
          if (event.key == "Enter") {
            console.log("回车键被点击");
          }
        },
      },
    };
    Vue.createApp(App).mount("#Application");
  </script>
</body>

</html>